import time
import requests
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("https://music.163.com/#/user/home?id=535529445")
#全屏网页
driver.maximize_window()
driver.implicitly_wait(10)
iframe = driver.find_element_by_xpath('//*[@id="g_iframe"]')
driver.switch_to.frame(iframe)
# m = driver.find_element_by_xpath('//*[@id="14526827001650959568389"]').get_attribute('class')
# m = driver.find_element_by_tag_name("tbody/tr[@class='even ']")
# m = driver.find_element_by_xpath("//tr[@id='14526827001650961131039']")
# url1 = driver.current_url
#view-source:https://music.163.com/playlist?id=5187647705
# url2 = 'view-source:' + url1
# page = driver.page_source
# print(page)
name = '越大越坏'
print(name)
# a = driver.find_element_by_xpath(f"//a[@title='{name}喜欢的音乐']")
# print(a.get_attribute('href'))
# driver.get(a.get_attribute('href'))
# a.click()
b = "https://music.163.com/playlist?id=4955543297"
b = f'"{b}"'
js=f'window.open({b});'

driver.execute_script(js)

# driver.get(url2)
# import requests
# resp = requests.get(url=url2)
# print(resp.text)
# print(m)
# for i in music_list:
#     print(i)
while 1 :
    # driver.find_element_by_xpath("//a[@data-module='my']").click()
    pass
